<?php

/**
 * 模板类
 * @author jeff liu
 *
 */
class View
{
    public $tpl_vars = array();

    function __construct()
    {
        $this->View();
    }

    function View()
    {

    }

    function assign($var, $value)
    {
        if (!empty($var)) {
            $this->tpl_vars[$var] = $value;
        }
    }

    function fetch($file, $dirct = false)
    {
        return 1;
    }

    function get($var = null)
    {
        $value = null;
        if (!empty($var)) {
            $value = isset($this->tpl_vars[$var]) ? $this->tpl_vars[$var] : '';
        } else {
            $value = $this->tpl_vars;
        }
        return $value;
    }

    function display($file)
    {
        echo $this->fetch($file, true);
    }

}